package Gui;


import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;


@SuppressWarnings("serial")
public class status_panel extends JPanel{

	static JScrollPane scrollPane;
	static JTextArea textArea;
	public status_panel() {
		setLayout(null);

		scrollPane = new JScrollPane();
		scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
		scrollPane.setBounds(0, 0, 215, 95);
		add(scrollPane);
		
		//scrollPane.scrollRectToVisible(
		//		  new Rectangle(0,scrollPane.getHeight()-2,1,1));

		textArea = new JTextArea();
		textArea.setAutoscrolls(false);
		textArea.setEditable(false);
		scrollPane.setViewportView(textArea);
		JScrollBar sb = status_panel.scrollPane.getVerticalScrollBar();
		sb.setValue( sb.getMaximum());
	}


	public static void println(String str){
		textArea.append("\n"+str);
		JScrollBar sb = status_panel.scrollPane.getVerticalScrollBar();
		sb.setValue( sb.getMaximum());
	}


	public static void print(String str){
		textArea.append(str);
		JScrollBar sb = status_panel.scrollPane.getVerticalScrollBar();
		sb.setValue( sb.getMaximum());
		
	}


	public static void print(StringBuffer str) {
		print(str.toString());
		JScrollBar sb = status_panel.scrollPane.getVerticalScrollBar();
		sb.setValue( sb.getMaximum());
	}


}
